Skip to content

Conversation

@amogh-jahagirdar
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar commented Nov 22, 2023

This change fixes some very confusing naming from my original implementation of the fastForward/replaceBranch APIs.

Prior to this change, the APIs had the following naming:

fastForward(String name, String source)
replaceBranch(String name, String source)

"Name" is the branch that would be fast forwarded and source is the "destination" or target we would fast forward to. This doesn't really align with how most people would think when it comes to fast forward or replace operations (like Git).

This change renames it to:

fastForward(String from, String to)
replaceBranch(String from, String to)

Note: This is just a rename of parameters and error messages. There is no change in behavior in the API.

@amogh-jahagirdar
Copy link
Contributor Author

amogh-jahagirdar commented Nov 22, 2023

cc @rakesh-das08 @singhpk234 This stems from our discussion on #8854 (comment)

@amogh-jahagirdar amogh-jahagirdar force-pushed the rename-source-target-ffapi branch 9 times, most recently from d33430d to 08e41ce Compare November 23, 2023 01:59
Preconditions.checkArgument(sourceRef != null, "Ref does not exist: %s", source);
Preconditions.checkArgument(refToUpdate.isBranch(), "Ref %s is a tag not a branch", name);
String from, String to, boolean fastForward) {
Preconditions.checkNotNull(from, "Branch to update cannot be null");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're a little inconsistent here in terms of null checking (throwing NPE vs IAE) but I guess that's out-of-scope for this PR, so just wanted to mention that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right, and this unfortunately applies to more than just replace/fastForward. (e.g. create, rename, as well throw an NPE instead of IAE). I'll take this in a follow on.

@amogh-jahagirdar
Copy link
Contributor Author

Merging, thanks for the reviews @nastra @rakesh-das08

@amogh-jahagirdar amogh-jahagirdar merged commit 6fc5be7 into apache:main Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants